// 类

class Person {
  name: string
  age: number

  constructor(name: string, age: number) {
    this.name = name
    this.age = age
  }


  eating() {
    console.info(this.name + "eating  ")
  }
}
const p = new Person('张三', 12)
p.eating()


// 类的继承

class Teacher extends Person {
  title: string = ""
  teaching() {
    console.info(this.title + '教书')
  }
}

// 类的多态

class Animal {
  action() {
    console.info('animal running')
  }
}

class Dog extends Animal {
  action() {
    console.log('dog running')
  }
}

class Fish extends Animal {
  action() {
    console.info('fish swimming')
  }
}

function makeAction(animals: Animal[]) {
  animals.forEach(animal => {
    animal.action()
  })
}

export { }